<?php
namespace Home\Controller;
use Think\Controller;
class ArticleController extends Controller {

	/**
	 * 初始化
	 */
	public function __construct() {
		parent::__construct();
	}
	
	/**
	 * 新闻列表
	 */
	public function index() {
		$id = I('get.id','','intval');
		$key = I('get.keyword','','strip_tags');
		if(!empty($key)) {
			$where['title'] = array('like','%'.$key.'%');
		}
		$where['cid'] = $id;
		$data = D('Admin/article')->where($where)->order("sort desc")->select(); 
		$this->assign('list',$data);
		/**jssdk***/
		$signPackage = $this->signPackage;
		$signPackage['title'] = "苗木通讯录";
		$signPackage['link'] = 'http://'.C('DOMAIN').U('Article/index');
		$signPackage['desc'] = "众里寻他千百度，苗友尽在通讯录，苗商驰骋天地间，买卖沟通更方便。";
		$signPackage['imgUrl'] = 'http://zhumeng777.com/Uploads/2016-09-18/57de84aca6a35.jpg';
		$this->assign('signPackage',$signPackage);
		/****/
		$this->display();
	}

	/**
	 * 内容页
	 */
	public function info() {
		$id = I('get.id','','intval');
		if(!empty($id)) {
			$info = D('article')->find($id);
			if(empty($info)) {
				die('not find this data');
			}
			$this->assign('info',$info);
		}
		/**jssdk***/
		$signPackage = $this->signPackage;
		$signPackage['title'] = "苗木通讯录";
		$signPackage['link'] = 'http://'.C('DOMAIN').U('Article/info',array('id'=>$id));
		$signPackage['desc'] = $info['title'];
		$signPackage['imgUrl'] = 'http://zhumeng777.com'.$info['img'];
		$this->assign('signPackage',$signPackage);
		/****/

		$this->display();
	}
	
}
